﻿using LxBasic;
using LxCore;

namespace LxCore
{
    public abstract class UserPara
    {
        public abstract class Base<T> : JsIdentifyItem
        {
            public override string Name
            {
                get => base.Name;
                set
                {
                    _Name = FindValidName(LxSim.Sim.Definitions, value);
                    RaisePropertyChanged(nameof(Name));
                }
            }
            public ParameterBase<T> Parameter { get; set; }
            public override void FromJsonKV(string key, IJsonReader jsReader)
            {
                switch (key)
                {
                    case nameof(Parameter): jsReader.ReadObject(Parameter, e => Parameter = e); break;
                    default: base.FromJsonKV(key, jsReader); break;
                }
            }
            public override void ToJsonKV(IJsonWriter jsWriter)
            {
                base.ToJsonKV(jsWriter);
                jsWriter.WriteObject(nameof(Parameter), Parameter, true);
            }
        }
        public class Double : Base<double>
        {

        }
        public class Vector : Base<Vector3d>
        {

        }

    }
}
